home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Why does the "universal bugfunction" gets() survive in 1996?
- Date: Sun, 24 Mar 96 14:32:11 GMT
- Organization: none
- Message-ID: <827677931snz@genesis.demon.co.uk>
- References: <DoDGq8.Dqq@scn.org> <4irokq$j1b@ferrari.NetXpress.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4irokq$j1b@ferrari.NetXpress.com>
- ghporter@NetXpress.com "Glenn H. Porter" writes:
-
- >Kurt,
- >
- >No function is inherently dangerous. The danger lies in expecting the
- >compiler/language to keep you from doing something dangerous. My
- >first C teacher told each of his classes "If you don't see the BIOS
- >copyright message as your program output, you're not trying. Just
- >make sure you don't see it twice for the same bug."
- >
- >If you use a function that dosn't check the length of the buffer, then
- >you have to check the buffer. It's that simple. If you don't like
- >it, don't use it.
-
- The problem is that gets() doesn't give you the opportunity to check the
- length of the buffer - whether it will write beyond it or not is entirely
- beyond the control of the rest of the program. gets() is inherently
- dangerous.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-